<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./clients.xhtml">


            <ui:define name="partieDroite">


                <h:form>

                    <p:panel id="panel" header="Détails sur le client">  

                        <h:panelGrid id ="grid" columns="2">  
                            
                            
                            
                            <h:outputText value="ID client: " />  
                            <h:outputLabel id="id1" value="#{compteBancaireMBean.detailsClient.id}"/>
                            
                            <h:outputText value="Nom client: " />  
                            <h:outputLabel id="id2" value="#{compteBancaireMBean.detailsClient.nom}"/>
                            
                            <h:outputText value="Prenom client:   " />  
                            <h:outputLabel id="id3" value="#{compteBancaireMBean.detailsClient.prenom}"/>
                            
                            <h:outputText value="Adresse client:   " />  
                            <h:outputLabel id="id4" value="#{compteBancaireMBean.detailsClient.adresse}"/>
                            
                            <h:outputText value="Login client:   " />  
                            <h:outputLabel id="id5" value="#{compteBancaireMBean.detailsClient.login}"/>
                            
                            <h:outputText value="Password client:   " />  
                            <h:outputLabel id="id6" value="#{compteBancaireMBean.detailsClient.password}"/>
                            


                        </h:panelGrid>  

                         <br></br>
                        <br></br>
                        <h:commandButton  value="Transfert d'argent" action="/faces/transfertArgent"/>

                        <br></br>
                        <br></br>
                        <br></br>

                        <p:panel id="panel2" header="Détails compte courant associé au client">  
                        </p:panel>

                        <p:dataTable value="#{compteBancaireMBean.getAfficherCompteCourantClient(compteBancaireMBean.detailsClient)}"  
                                     widgetVar="detailOTable" var="item" >




                            <p:column headerText="CompteID"
                                      filterMatchMode="contains">
                                <f:facet name="header">
                                    <h:outputText value="ID"/>
                                </f:facet>
                                <h:commandLink action="#{compteBancaireMBean.showDetails(item)}" value="#{item.id}"/> 
                            </p:column>





                            <p:column headerText="CompteSolde"
                                      filterMatchMode="contains">
                                <f:facet name="header">
                                    <h:outputText value="Solde"/>
                                </f:facet>
                                <h:outputText value="#{item.soldeCompte}"/>
                            </p:column>

                            <p:column headerText="TYPE"
                                      filterMatchMode="contains">
                                <f:facet name="header">
                                    <h:outputText value="TYPE"/>
                                </f:facet>
                                <h:outputText value="#{item.type}"/>
                            </p:column>


                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Date ouverture"/>
                                </f:facet>
                                <h:outputText value="#{item.dateOuverture}">
                                    <f:convertDateTime pattern="dd/MM/yyyy" />
                                </h:outputText>
                            </p:column>

                            <p:column style="text-align: center">
                                <f:facet name="header">
                                    <h:outputText value="Autre"/>
                                </f:facet>
                                <h:commandButton  action="#{compteBancaireMBean.operationB(item)}" image="./images/details.png"/>

                            </p:column>

                        </p:dataTable>

                        <br></br>
                        <br></br>


                        <p:panel id="panel3" header="Détails compte epargne associé au client">  
                        </p:panel>


                        <p:dataTable value="#{compteBancaireMBean.compteEpargneClient}"  widgetVar="detailOTable" var="compte"  >



                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="id"/>
                                </f:facet>
                                <h:outputText value="#{compte.id}"/>
                            </p:column>

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="soldeCompte"/>
                                </f:facet>
                                <h:outputText value="#{compte.soldeCompte}"/>
                            </p:column>

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="taux"/>
                                </f:facet>
                                <h:outputText value="#{compte.taux}"/>
                            </p:column>
                            
                             <p:column style="text-align: center">
                                <f:facet name="header">
                                    <h:outputText value="Autre"/>
                                </f:facet>
                                <h:commandButton  action="#{compteBancaireMBean.operationCompteEpargne(compte)}" image="./images/details.png"/>

                            </p:column>



                        </p:dataTable>
                    </p:panel>  


                </h:form>
            </ui:define>

        </ui:composition>

    </body>

</html>
